
<template>
	<view><menuBox :menuInfo="menuInfo"></menuBox></view>
</template>

<script>
import menuBox from '@/wxcomponents/commonLayout/menu';
import common from '@/libs/login.js';
import userMixins from '@/libs/userMixins.js'
export default {
	mixins: [userMixins],
	// 0-班主任,1-普通教职工,2-学生,3-家长,4-教务主任,5-部门主任,6-校领导,7-报修专员,8-任课教师，9-学工主任，10-宿舍管理员
	data() {
		return {
			menuInfo: {
				base: {
					menuProp: ['name']
				},
				list: []
			},
		};
	},
	async onShow() {
		let list = [
			{
				name: '学生请假审批',
				url: 'leaveList?role=student',
				dotKey: 'STUDENTLEAVE',
				dotNum: 0
			},
			{
				name: '学生实习审批',
				url: 'practiceList',
				dotKey: 'STUDENTPRACTICE',
				dotNum: 0
			},
			{
				name: '教师请假审批',
				url: 'leaveList?role=teacher',
				dotKey: 'LEAVE',
				dotNum: 0
			},
			{
				name: '调代课审批',
				url: 'approvalList?module=调代课',
				dotKey: 'COURSE',
				dotNum: 0
			},
			{
				name: '代课审批',
				url: 'approvalList?module=停课',
			},
			{
				name: '报销审批',
				url: 'approvalList?module=报销',
				dotKey: 'REIMBURSE',
				dotNum: 0
			},
			{
				name: '会议审批',
				url: 'approvalList?module=会议',
				dotKey: 'MEETING',
				dotNum: 0
			},
			{
				name: '用车审批',
				url: 'approvalList?module=用车',
				dotKey: 'CAR',
				dotNum: 0
			},
			{
				name: '用章审批',
				url: 'approvalList?module=用章',
				dotKey: 'SEAL',
				dotNum: 0
			},
			{
				name: '用餐审批',
				url: 'approvalList?module=用餐',
				dotKey: 'DINNER',
				dotNum: 0
			},
			{
				name: '报修处理',
				url: 'approvalList?module=报修',
				dotKey: 'REPAIRS',
				dotNum: 0
			},
		]
		this.menuInfo.list = this.getHaveOpList(list);
		this.menuInfo.list.map(async item => {
			// item.name += `(${await this.getDot(item.dotKey)})`;
			item.dotNum = await this.getDot(item.dotKey)
		})
	},
	methods: {
		async getDot(key) {
			let resp = await this.$http.get({
				url: `/oa/unApprovedTaskNumber/countTaskNumber?dictCountByAuditType=${key}`,
			});
			return resp.result.unHandledNumber;
		}
	},
	components: {
		menuBox
	}
};
</script>

<style lang="scss" scoped></style>
